/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package xmluebung2;

/**
 * Panel for the function x².
 * 
 * @author Adrian Cieluch
 */
public class Panel_x2 extends AbstractPanel {
    
    /**
     * Creates the Panel and sets the tool tip text.
     * 
     * @param x x coordinate
     * @param y y coordinate
     * @param s colorscheme
     * @param w width
     * @param h height
     */
    public Panel_x2(int x, int y, ColorScheme s, int w, int h) {
        super(w, h);
        this.setBounds(x, y, w, h);
        
        this.setDefinitionValues(10);
        this.setColorScheme(s);
        this.setFunctionValues();
        this.setToolTipText("Funktion: f(x) = x^2   von x = -10 bis x = 10");
    }

    /**
     * Calculates the y value based on the mathmatical function.
     * 
     * @param x x value to be calculated
     * @return calculated y value
     */
    @Override
    public double calculateYValue(double x) {
        return -(x*x);
    }
    
}
